const request = require('../utils/request')

/**
 * 执行登录
 * @param data
 * @returns {Promise<unknown>}
 */
export const login = (data) => request.post('/api/auth/login',data)

/**
 * 执行注册
 * @param  data 
 * @returns {Promise<unknown>}
 */
export const register = (data) => request.post('/api/auth/register',data)

/**
 * 
 * 发送code，获取openid，已有用户信息(已绑定的情况)
 * @param  data 
 * @returns {Promise<unknown>}
 */
export const getOpenid = (data) =>request.post('/api/auth/wx/code',data,false)

/**
 * 对当前登录的账号，绑定微信
 * @param data 
 * @returns {Promise<unknown>}
 */
export const bindOpenid = (data) =>request.post('/api/auth/wx/bind',data)

/**
 * 退出登录
 * @returns {Promise<unknown>}
 */
export const logout = () => request.post('/api/auth/logout')
/**
 * 获取oss上传配置
 * @returns {Promise<unknown>}
 */
export const getOssConfig = () =>request.get('/api/auth/oss/token')
/**
 * 获取我的收藏信息
 * @param data
 * @return {Promise<unknown>}
 */
export const getMyCollect = (data) =>request.get('/api/collects',data)